<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/x-icon" href="static/upFile.png">
    <title>上传文件</title>
    <script src="static/thanks.js"></script>
    <link rel="stylesheet" type="text/css" href="static/default.css">
    <script>
        function handleFileSelect(event) {
            var files = event.target.files[length];
            var reader = new FileReader();
            if (20971520 > files["size"]) {
                document.getElementById("fileName").innerHTML = "文件名称：" + files["name"];
                document.getElementById("fileSize").innerHTML = "文件大小：" + files["size"] + "字节";
                document.getElementById("fileLastChangeTime").innerHTML = "修改时间：" + files["lastModifiedDate"];
                reader.readAsText(files, "utf-8");
            } else { alert('文件大小不能超过20M！'); }
        }

    </script>
</head>

<body>
    <div class="title">
        <img src="static/upFile.png" width="140px" height="140px" alt=""><b>上传文件</b>
    </div>
    <p>当前位置：<a href="SendAndSave">文件互传</a>><a href="">上传文件</a></p>
    <div style="text-align: center;">
        <form action="" method="post" enctype="multipart/form-data">
            <input type="file" name="file" id="upload" onchange="handleFileSelect(event)" style="display: none;"><br>
            <input type="button" onclick="document.getElementById('upload').click();" value="选择文件">
            <div id="_message">
                <hr>
                <p id="fileName">文件名称：未选择</p>
                <p id="fileSize">文件大小：未选择</p>
                <p id="fileLastChangeTime">修改时间：未选择</p>
                <hr>
            </div>
            <input type="submit" onclick="save()" value="确定上传">
        </form>
    </div>
</body>

</html>
<script>
    if (window.File && window.FileReader && window.FileList && window.Blob) {
    } else {
        alert('您的浏览器不支持文件上传！请先升级您的浏览器！');
    }
</script>